//======================================================================
/// COPYRIGHT MorningCoreTech CO.,LTD
/// @file        PUCCH_QAMMod_fix.cpp
/// @brief       This function performs PUCCH Modulation Proc
/// @author      cuiyuping
/// @param [IN]	     SimParam		       Input  Parameter .
/// @param [IN]	     QAM_Op		           Modulation Data
/// @param [IN]	    PUCCH_ZC_Data		   DMRS Sequence.     
/// @param [OUT]	PUCCH_ResOp		       PUCCH Spreading Result.     
/// @par History
/// -
///       Date|       Author|        Version|        DESCRIPTION
/// ----------|-------------|---------------|-------------------
/// 2022-10-20|   cuiyuping |          0.0.1|            created
//======================================================================
#include "../../../CommLib_FxpC/lib_arith_N.h"
#include "../common/head/NR_UL_macro.h"
#include "ue_tx_pucch_qammod_fix.h"

/*----------- function definition-----------------------------------*/
/*****************************************************************************
* Function: PUCCH_QAMModu()
* Purpose:  performs pucch modulation
*
* Relation:
Calls       : ....
Called by   : ....
* Params:
*   <Name>          <Type>      <In/Out>    <Description>

  * Return:  void
  * Note:    <no>
*******************************************************************************/
void PUCCH_QAMMod_fix
(  IN stULParamTable *SimParam,
    int8       *DataIp,
    cmplx_frN  *DataOp
)
{
    int    i;  // for cycle
    /*Init*/
    /*Function body*/
	if (PUCCH_FORMAT_0 == SimParam->PUCCH_Format)  
	{
		if (1 == SimParam->UCI_Len)
		{
			DataOp[0].re = (1 - 2 * DataIp[0]); 
			DataOp[0].im = (1 - 2 * DataIp[0]); 
			
		}
		else //(2 == UCI_Len)
		{
			DataOp[0].re = (1 - 2 * DataIp[0]);
			DataOp[0].im = (1 - 2 * DataIp[1]);		
		}
		SimParam->ModSymLen = 1;
	}
	else if (PUCCH_FORMAT_1 == SimParam->PUCCH_Format)
	{

			for (i = 0; i < (SimParam->UCI_Len / 2); i++)  //QPSK
			{
				DataOp[i].re = 1 - 2 * DataIp[2 * i];
				DataOp[i].im = 1 - 2 * DataIp[2 * i + 1];

			}
			SimParam->ModSymLen = SimParam->UCI_Len / 2;		

    }

}



